@tailwind base;
@tailwind components;
@tailwind utilities;

@layer base {
  :root {
    --color-pink-light: rgb(93 168 255); /* 定义亮色主题下的滚动条颜色 */
    height: 100vh;
    --content-background: #fefefe;
    --ifm-color-primary: #12affa;
    --ifm-color-primary-dark: #05a1ec;
    --ifm-color-primary-darker: #0598df;
    --ifm-color-primary-darkest: #047eb8;
    --ifm-color-primary-light: #2cb8fb;
    --ifm-color-primary-lighter: #b0e6ff;
    --ifm-color-primary-lightest: #d5f1fd;
    --ifm-code-font-size: 95%;
    --ifm-font-family-base: misans, ui-sans-serif, system-ui, -apple-system;

    --ifm-heading-font-family: ui-sans-serif, system-ui, -apple-system;

    --ifm-navbar-background-color: white;
    --ifm-navbar-shadow: 0 4px 28px rgb(0 0 0 / 10%);

    --ifm-menu-color: #0d203a;

    /* 代码块 */
    --prism-background-color: #f6f8fa;
    --ifm-code-padding-horizontal: 0.2rem;
    --ifm-code-padding-vertical: 0.2rem;

    /* 文本 */
    --ifm-text-color: #333;
    --ifm-secondary-text-color: #555;

    --site-primary-hue-saturation: 167 68%;
    --site-primary-hue-saturation-light: 167 56%;

    --site-color-favorite-background: #f6fdfd;
    --site-color-tooltip: #fff;
    --site-color-tooltip-background: #353738;
    --site-color-svg-icon-favorite: #e9669e;
    --site-color-checkbox-checked-bg: hsl(167deg 56% 73% / 25%);

    --ifm-container-width: 1024px;

    --ifm-heading-color: hsl(214deg 78% 17%);
    --ifm-heading-font-weight: 500;
    --ifm-font-weight-bold: 520;
    --ifm-border-color: #e5e7eb;
    --ifm-toc-border-color: var(--ifm-border-color);

    --blog-item-background-color: linear-gradient(180deg, #fcfcfc, #fff);
    --blog-item-shadow: 0 10px 18px #f1f5f9dd, 0 0 10px 0 #e4e4e7dd;
    --blog-item-shade: #f4f4f5;

    -webkit-font-smoothing: unset;

    --docusaurus-highlighted-code-line-bg: #d1d5db;
  }

  html[data-theme="dark"] {
    --color-green-light: #322d31; /* 定义暗色主题下的滚动条颜色 */
    --content-background: #18181b;
    --ifm-color-primary: hsl(214deg 100% 60%);
    --ifm-color-primary-light: hsl(214deg 100% 75%);
    --ifm-heading-color: hsl(0deg 0% 100%);
    --ifm-menu-color: #eceef1;
    --ifm-text-color: var(--ifm-menu-color);
    --ifm-secondary-text-color: #eee;
    --ifm-border-color: #313131;

    --ifm-navbar-background-color: var(--content-background);
    --ifm-toc-border-color: var(--ifm-border-color);

    --blog-item-background-color: linear-gradient(180deg, #171717, #18181b);
    --blog-item-shadow: 0 10px 18px #25374833, 0 0 8px #25374866;
    --blog-item-shade: #27272a;

    --docusaurus-highlighted-code-line-bg: #4b5563;
  }
}

a:hover {
  color: #72a1ed;
}

@layer components {
  .bg-blog {
    background: var(--blog-item-background-color);
  }
  .bg-blog-shade {
    background: var(--blog-item-shade);
  }
}

html,
body {
  font-family: misans, system-ui, -apple-system, "PingFang SC",
    "Microsoft YaHei";
  scroll-behavior: smooth;
  height: 100vh;
  margin: 0;
}

.navbar__item {
  display: inline-flex;
}

.navbar__link {
  @apply flex items-center;
}

.theme-code-block {
  --prism-background-color: #f6f8fa !important;
}

html[data-theme="dark"] .theme-code-block {
  --prism-background-color: #1e1e1e !important;
}

article .markdown a:not(.hash-link) {
  text-decoration: none;
  font-weight: inherit;
  border-bottom: 1px solid rgba(125, 125, 125, 0.3);
  transition: border 0.3s ease-in-out;
}

article .markdown a:not(.hash-link):hover,
article .markdown a:not(.hash-link):focus {
  border-bottom: 1px solid var(--ifm-color-primary-light);
}

article .markdown code {
  border: 0.1rem solid transparent;
}

article .markdown .alert {
  border: 2px solid var(--ifm-alert-border-color);
}

article .markdown img {
  border-radius: 10px;
  display: flex;
  margin: 0 auto;
}

article .markdown > h2 {
  font-size: 1.6em;
}

article .markdown > h3 {
  font-size: 1.4em;
}

article .markdown > h4 {
  font-size: 1.2em;
}

article .markdown-body a:hover::before {
  width: 100%;
}

article .a-icon {
  display: none;
}

article p > span > .a-icon {
  display: block;
}

article p > span > a {
  line-height: 1.5rem;
}

:where(html[data-theme="dark"]) article .markdown strong {
  color: #fff;
}

.navbar {
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  background-color: hsla(0, 0%, 100%, 0.2);
  box-shadow: 0 0 0.2rem rgba(0, 0, 0, 0.102),
    0 0.2rem 0.4rem rgba(0, 0, 0, 0.2);
  opacity: 1;
  /* 添加过渡动画 */
  transition: backdrop-filter 0.5s linear, background-color 0.5s linear,
    box-shadow 0.5s linear, opacity 0.5s linear;
}

.navbar-sidebar__items {
  height: calc(100% - var(--ifm-navbar-height) - 444px);
}

@media (max-width: 570px) {
  h1 {
    font-size: 1.6em;
  }

  article > .markdown > h2 {
    font-size: 1.4em;
  }

  article > .markdown > h3 {
    font-size: 1.2em;
  }
}

@media (max-width: 1100px) {
  .navbar > .container,
  .navbar > .container-fluid {
    padding: 0;
  }

  .navbar__toggle {
    display: inherit;
  }

  .navbar__item {
    display: none;
  }

  .navbar__search-input {
    width: 9rem;
  }

  .navbar-sidebar {
    height: 200rem; /* 高度为视口高度的 200rem */
  }
}

.navbar-sidebar__backdrop {
  /* 移动端侧边栏背景色,背景色为透明 */
  background-color: rgba(0, 0, 0, 0);
}
code {
  color: var(--ifm-code-color);
}

div[class^="announcementBar_"] {
  background: repeating-linear-gradient(
    -35deg,
    var(--ifm-color-primary-lighter),
    var(--ifm-color-primary-lighter) 20px,
    var(--ifm-color-primary-lightest) 10px,
    var(--ifm-color-primary-lightest) 40px
  );
  font-weight: 700;
}
.code-block-error-line {
  background-color: #ff000020;
  display: block;
  margin: 0 calc(-1 * var(--ifm-pre-padding));
  padding: 0 var(--ifm-pre-padding);
  border-left: 3px solid #ff000080;
}

.gsc-comments textarea {
  background: var(--content-background);
}

.tag::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  transform: scaleX(0);
  height: 2px;
  background: var(--ifm-color-primary);
  visibility: hidden;
  transition: all 0.3s linear;
}

.tag:hover::after {
  visibility: visible;
  transform: scaleX(1);
}

.github-stats::-webkit-scrollbar {
  display: none;
}

.prose :where(img):not(:where([class~="not-prose"], [class~="not-prose"] *)) {
  margin: 0;
}

.prose
  :where(strong):not(:where([class~="not-prose"], [class~="not-prose"] *)) {
  color: var(--tw-prose-bold);
  font-weight: 520;
}

.prose
  :where(code):not(
    :where([class~="not-prose"], [class~="not-prose"] *)
  )::before {
  content: "";
}

.prose
  :where(code):not(
    :where([class~="not-prose"], [class~="not-prose"] *)
  )::after {
  content: "";
}

.wave {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100px;
  background-color: #eaf6ff; /* 调整颜色以适应您的设计 */
}

.wave::before,
.wave::after {
  content: "";
  position: absolute;
  width: 100%;
  height: 100px;
  background-color: inherit;
  transform: scaleY(0.5);
}

.wave::before {
  bottom: 100%;
  z-index: -1;
}

.wave::after {
  top: 100%;
  transform: scaleY(-0.5);
}

/* 侧边栏左侧线条 */
.menu__list .menu__list {
  border-bottom: 2px solid #ced9e3;
  /* 设置底部边框颜色为透明 */
  border-bottom-color: #ffffff00 !important;
  /* 设置左边框颜色 */
  border-left: 2px solid #ced9e3;
  /* 设置边框圆角 */
  border-radius: 0 0 0 10px;
  /* 设置左边距 */
  margin-left: 1rem;
  /* 设置左边内边距 */
  padding-left: 0.3rem;
}

/* 分页导航 */
.pagination-nav__link {
  border: 1px solid #00000000;
  padding: 0.5rem;
  margin: 0 0.5rem;
  transition: all 0.3s ease-in-out;
}

.pagination-nav__link:hover {
  border: 1px solid #72a1ed;
  transform: scaleX(0.9); /* 缩小宽度到 90% */
}

.pagination-nav__label:hover {
  transform: scale(1.1); /* 将元素缩小到原始大小的 80% */
  transition: transform 0.3s ease; /* 平滑过渡效果 */
  display: inline-block; /* 确保元素在缩放时不会破坏布局 */
}

.pagination-nav {
  border: solid #d8d8d8;
  border-width: 2px 0 0;
  margin: 2em 0;
  padding-top: 0.5rem;
}

.pagination-nav__sublabel {
  /* 上一页下一页文字颜色 */
  color: #72a1ed;
}

/* 样式规则适用于所有的 .table-of-contents__link 元素 */
.table-of-contents__link {
  border-radius: 8px; /* 圆角边框 */
  margin-top: -0.5rem; /* 上边距，调整元素的垂直位置 */
  padding: 0.3rem 0 0.3rem 1rem; /* 内边距，顶部和底部 0.3rem，左侧 1rem */
  font-weight: 550; /* 字体加粗 */
  transition: 0.25s !important; /* 过渡效果，设置样式变化的过渡时间 */
}

/* 鼠标悬停时的样式 */
.table-of-contents__link:hover,
.table-of-contents__link:hover code {
  background-color: rgba(4, 184, 145, 0.395); /* 背景颜色，带透明度 */
  color: #333; /* 字体颜色 */
}

/* 激活状态下的样式 */
.table-of-contents__link--active,
.table-of-contents__link--active code {
  background-color: #00d7a8; /* 背景颜色 */
  color: #fff; /* 字体颜色 */
}

/* 全局滚动条样式 */
::-webkit-scrollbar {
  width: 0.5rem;
  height: 0.5rem;
}

::-webkit-scrollbar-track {
  border-radius: 2em;
}

/* 滚动条滑块样式 */
::-webkit-scrollbar-thumb {
  background-color: var(--color-pink-light);
  background-image: -webkit-linear-gradient(
    45deg,
    hsla(0, 0%, 100%, 0.4) 25%,
    transparent 0,
    transparent 50%,
    hsla(0, 0%, 100%, 0.4) 0,
    hsla(0, 0%, 100%, 0.4) 75%,
    transparent 0,
    transparent
  );
  border-radius: 2em;
}

/* 滚动条滑块悬停效果 */
::-webkit-scrollbar-thumb:hover {
  background: #aaaaaa;
  background-image: -webkit-linear-gradient(
    45deg,
    hsla(0, 0%, 100%, 0.4) 25%,
    transparent 0,
    transparent 50%,
    hsla(0, 0%, 100%, 0.4) 0,
    hsla(0, 0%, 100%, 0.4) 75%,
    transparent 0,
    transparent
  );
  border-radius: 2em;
}

/* 确保目录容器可滚动 */
.tableOfContents_src-theme-TOC-styles-module {
  overflow-y: auto; /* 启用垂直滚动条 */
  scrollbar-width: thin; /* Firefox 滚动条宽度 */
  scrollbar-color: var(--color-pink-light) transparent; /* Firefox 滚动条滑块和轨道颜色 */
}

/* WebKit 浏览器的滚动条样式 */
.tableOfContents_src-theme-TOC-styles-module::-webkit-scrollbar {
  width: 0.5rem; /* 滚动条宽度 */
}

.tableOfContents_src-theme-TOC-styles-module::-webkit-scrollbar-thumb {
  background: var(--color-pink-light); /* 滚动条滑块的颜色 */
  border-radius: 2em; /* 滚动条滑块的圆角 */
}

.tableOfContents_src-theme-TOC-styles-module::-webkit-scrollbar-thumb:hover {
  background: #26c6da; /* 滚动条滑块悬停时的颜色 */
}

/* 尝试隐藏 WebKit 浏览器中的滚动条按钮（上下箭头） */
.tableOfContents_src-theme-TOC-styles-module::-webkit-scrollbar-button {
  display: none; /* 隐藏滚动条按钮 */
}

/* 隐藏滚动条背景 */
.tableOfContents_src-theme-TOC-styles-module::-webkit-scrollbar {
  background: transparent; /* 隐藏滚动条背景 */
}

/* 明亮模式样式 */
.tableOfContents_src-theme-TOC-styles-module {
  /* 由于不同浏览器兼容性和箭头不能隐藏，直接把整个目录滚动条隐藏了 */
  --color-pink-light: #00000000; /* 明亮模式下的滚动条颜色 */
}

/* 暗黑模式样式 */
@media (prefers-color-scheme: dark) {
  .tableOfContents_src-theme-TOC-styles-module {
    --color-pink-light: #322d31; /* 暗黑模式下的滚动条颜色 */
  }
}

/* 返回顶部按钮样式 */
[class*="backToTopButton"] {
  /* 全局样式覆盖 */
  outline: none !important;
  box-shadow: none !important;
  background-color: transparent !important;
  background-image: url(/static/svg/back-top.svg) !important;
  background-size: cover !important;
  transition: transform 0.8s ease-in-out !important;
}

[class*="backToTopButton"]:hover {
  background-color: transparent !important;
  transform: scale(1.2) !important;
}

[class*="backToTopButton"]::after {
  background-color: transparent !important;
}
